// -----------------------------
// Author: 		Dhaenens Gert 
// Creation: 	2/27/2015 7:03:41 PM				
// -----------------------------

#ifndef _CBuffer_h
#define _CBuffer_h

#include "IBuffer.h"
#include "DxIncludes.h"

namespace Flow
{

	class CBuffer : public IBuffer
	{
	public:
		CBuffer();
		virtual ~CBuffer();

		// Release the Buffer
		virtual void	Release();

		// Create the Buffer
		virtual Bool	Create(IGraphicsDevice* lpDevice, BufferType::Enum type, void* lpData, Size_T elementSize, Size_T elementCount);
		// Update the Buffer
		virtual void	Update(IGraphicsDevice* lpDevice, void* lpData, Size_T dataSize);

		// Does the Buffer have Data?
		virtual Bool	HasData() const;
		// Get the size of 1 element
		virtual Size_T	GetElementSize() const;
		// Get the amount of elements
		virtual Size_T	GetElementCount() const;
		// Get the total size of the buffer
		virtual Size_T	GetTotalSize() const;

	private:

		Bool				m_HasData;
		BufferType::Enum	m_Type;
		Size_T				m_ElementSize;
		Size_T				m_ElementCount;

		ID3D11Buffer*				m_lpBuffer;
		ID3D11ShaderResourceView*	m_lpShaderView;
		
		CBuffer(const CBuffer& refCBuffer);
		CBuffer& operator=(const CBuffer& refCBuffer);
	};

}

#include "ExportMacro.h"
EXPORT_IMPLEMENTATION(Buffer);

#endif